const express = require('express')
const router = express.Router()
const db = require('../../../MySql')
const {formatDateTime}=require('../../utils/dateUtils')

router.post('/repo/detail', async (req, res) => {
    try {
        const { id } = req.body
        const [results]=await db.query('select * from el_repo where id=?',[id])
        return res.json({
            "msg": "操作成功！",
            "code": 0,
            "data": {
                "id": results[0].id,
                "code": "",
                "title": results[0].title,
                "remark": results[0].remark,
                "createTime": formatDateTime(results[0].createTime),
                "updateTime": formatDateTime(results[0].updateTime)
            },
            "success": true
        })
    } catch (error) {
        console.log(error)
        return res.status(500).json({
            msg: 'Internal server error',
            code: 500,
            success: false
        })
    }
})


module.exports = router